# -*- Python -*-

# This file is part of SymCC.
#
# SymCC is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# SymCC is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# SymCC. If not, see <https://www.gnu.org/licenses/>.

import os
from os import path

# Used by lit to locate tests and output locations
config.test_source_root = "@CMAKE_CURRENT_SOURCE_DIR@"
config.test_exec_root = "@CMAKE_CURRENT_BINARY_DIR@"

outputDir = "@CMAKE_CURRENT_BINARY_DIR@/SymccOutput"
try:
    os.mkdir(outputDir)
except OSError:
    # Directory exists - fine
    pass

config.environment["SYMCC_OUTPUT_DIR"] = outputDir

# Delegate to the generic configuration file
lit_config.load_config(config, path.join(config.test_source_root, "lit.cfg"))

# Depending on the backend, the tests have to look for different output
config.substitutions += [
    ("%filecheck", "FileCheck @SYM_TEST_FILECHECK_ARGS@"),
]

if "@TARGET_32BIT@" == "ON":
    config.suffixes.add(".test32")
